<!-- * 文件名：提现
* 作者：ZQK
* 描述：〈描述〉
* 修改人：ZQK
* 修改时间：2025-3-9  -->
<template>
	<view class="partner">
		<view class="content">
			<view class="cell">
				<view class="cellTitle">
					<view class="cellTitleText">提现金额</view>
				</view>
				<view class="cellContent">
					<u-input v-model="username" type="text" placeholder="请输入金额" placeholder-style="color: #A3A3A3" />
				</view>
			</view>
			<view class="cell">
				<view class="cellTitle">
					<view class="cellTitleText">每月提现上限￥5000</view>
				</view>
			</view>
			<view class="cell">
				<view class="cellBetween">
					<view class="cellTitleText">提现至微信</view>
					<view class="cellTitleImage">
						<image :src="getUrl('/selected.png')" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view class="btnBox">
			<!--  @click="handleToRecruit" -->
			<view class="btn">确认提现</view>
		</view>
		
		<view class="bottomText">
			<view class="">温馨提示:</view>
			<view class="">1、每月3日后可申请上月佣金提现；</view>
			<view class="">2、提现申请发起后，预计在7个工作日内日到账</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { reactive, ref } from 'vue'
	import { onShow, onLoad } from "@dcloudio/uni-app"
	import { getUrl } from '@/utils/imagePlugin'
	import Api from '@/api/modules/home.ts'
	
	let username = ref<string>('')
	let phone = ref<string>('')
	let checkbox = ref<boolean>(false)
	
	const toHtmlPage = (type: string) => {
		uni.navigateTo({
			url: '/pages/document/document?type=' + type
		})
	}
	
	const handleToHome = () => {
		uni.navigateBack();
	}
	
	let btnLoading = ref<boolean>(false)
	const handleToRecruit = () => {
		if (!checkbox.value) {
			uni.showToast({ title: '为了更好的保障您的权益，请您阅读并同意《用户协议》和《隐私政策》', icon: 'none' });
			return;
		}
		if (!username.value) {
			uni.showToast({ title: '请输入姓名', icon: 'none' });
			return;
		}
		if (!phone.value) {
			uni.showToast({ title: '请输入手机号', icon: 'none' });
			return;
		}
		if(btnLoading.value){
			return;
		}
		btnLoading.value = true
		
		let params = {
			nickname: username.value,
			phone: phone.value
		}
		Api.applyPartner(params).then((res: any) => {
			uni.showToast({ title: '提现成功！', icon: 'none' });
			setTimeout(()=>{
				uni.navigateBack();
				btnLoading.value = false
			}, 1500)
		}).catch(()=>{
			btnLoading.value = false
		})
	}
	
	onLoad((options: any)=>{
		phone.value = options.phone
	})
</script>

<style lang="scss" scoped>
	.partner{
		display: flex;
		flex-direction: column;
		align-items: center;
		height: 100vh;
		position: relative;
		
		.logo{
			width: 100%;
			height: 600rpx;
		}
		
		.content{
			width: 100%;
			
			.cell {
				// display: flex;
				// align-items: center;
				font-size: 26rpx;
				color: #000000;
				border-bottom: 1rpx solid #c5c5c5;
				padding: 0 40rpx;
				
				.cellBetween{
					display: flex;
					justify-content: space-between;
					align-items: center;
					line-height: 80rpx;
					height: 80rpx;
					
					.cellTitleImage{
						display: flex;
						align-items: center;
						
						image{
							width: 40rpx;
							height: 40rpx;
						}
					}
				}
			
				.cellTitle {
					color: #000000;
					position: relative;
					// width: 180rpx;
					line-height: 80rpx;
					height: 80rpx;
			
					.asterisk {
						position: absolute;
						top: 8rpx;
						left: -20rpx;
						font-size: 36rpx;
						color: #C35736;
						font-weight: 600;
						display: flex;
						align-items: center;
						margin-right: 4rpx;
					}
			
					.cellTitleText {
						color: #000000;
					}
					
					
				}
			
				.cellContent {
					border-top: 1rpx solid #c5c5c5;
					display: flex;
					align-items: center;
					min-height: 70rpx;
					line-height: 80rpx;
					height: 80rpx;
			
					.reportBox {
						flex: 1;
						display: flex;
						flex-wrap: wrap;
			
						.noneReport {
							color: #A3A3A3;
							flex: 1;
						}
			
						.reportList {
							flex: 1;
							margin-right: 16rpx;
						}
					}
				}
			}
		}
		
		.agreement{
			display: flex;
			justify-content: center;
			margin: 40upx 0;
			
			.agree-text{
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				color: #666;
				text-align: center;
				font-family: "PingFang SC";
				font-size: 12px;
				font-style: normal;
				font-weight: 400;
				line-height: normal;
				
				.agree-text-h{
					color: #5EB847;
					margin: 0 12rpx;
				}
			}
		
		}
		
		.btnBox{
			width: 100%;
			margin-top: 80rpx;
			padding: 0 40rpx;
			display: flex;
			justify-content: space-between;
			
			.btn{
				width: 100%;
				background: #5EB847;
				border: 1rpx solid #ffffff;
				padding: 20rpx;
				color: #ffffff;
				border-radius: 50rpx;
				font-size: 36rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
		
		.bottomText{
			margin-top: 80rpx;
			line-height: 50rpx;
		}
	}
</style>